//
//  HKResultMessage.h
//  HKNetService
//
//  Created by 胡锦涛 on 2018/6/12.
//  Copyright © 2018年 胡锦涛. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, HKServiceError) {
    HKServiceErrorNone = 0x00,
    //网络错误，但是使用了缓存
    HKServiceErrorNetworkButUseCache = 0x01,
    
    HKServiceErrorUrlOrFileNotFound = 0x02,
    HKServiceErrorCantParse = 0x03,
    HKServiceErrorServer = 0x04,
    HKServiceErrorNetwork = 0x05,
    HKServiceErrorParse = 0x06,
    HKServiceErrorNotLogin = 0x07,
    HKServiceErrorUnknown = 0xFF,
};
typedef NS_ENUM(NSInteger, HKServiceResult) {
    /**
     * 请求成功
     */
    HKServiceResultSuccess = 0,
    /**
     *权限校验失败,禁止访问
     */
    HKServiceNonePermit = 1,
    /**
     *该手机已注册
     */
    HKServiceRegistered = 2,
    /**
     *用户不存在
     */
    HKServiceUserNotExist = 3,
    /**
     *用户登录已失效，请重新登陆
     */
    HKServiceIllegalUserId = 4,
    /**
     *用户目前被禁止登录！
     */
    HKServiceUserLoginDisable = 5,
    /**
     *作品不存在或该作品不属于你！
     */
    HKServiceProductionNotExist = 6,
    /**
     *"banner不存在！
     */
    HKServiceBannerNotExist = 7,
    /**
     *手机号参数为空！
     */
    HKServicePhoneNumIsNull = 8,
    /**
     *验证码发送失败！
     */
    HKServiceSendMessageFail = 9,
    /**
     *验证码填写错误
     */
    HKServiceVerificationCodeNotMatch = 10,
    /**
     *验证码失效
     */
    HKServiceVerificationCodeTimeOut = 11,
    /**
     *验证码5分钟内有效，无需重新发送
     */
    HKServiceVerificationCodeExist = 12,
    /**
     *验证码发送次数受限
     */
    HKServiceVerificationCodeCountLimit = 13,
    /**
     *文件上传失败
     */
    HKServiceFileUploadFail = 14,
    /**
     *该用户没有权限评论
     */
    HKServiceCommentState = 15,
    /**
     *该用户没有权限应用
     */
    HKServiceUseNotProduction = 16,
    /**
     *token失效或在其他地方登陆
     */
    HKServiceToken_is_invalite = 17,
    /**
     *含敏感字符，别调皮哦~
     */
    HKServiceSensitiveWords = 21,
    /**
     *远程请求失败，请稍后再试~
     */
    HKServiceRemoteError = 25,
    /**
     *系统错误
     */
    HKServiceSystemError = 101,
    /**
     *必要参数为空
     */
    HKServiceNullContent = 102,
    
    HKServiceNone = 1000002,
};

@class HKResultMessage;
typedef void(^PrepareBlock) (HKResultMessage *resultMessage);
typedef void(^StartElementBlock) (NSString *elementName, NSDictionary *attributeDict);
typedef void(^EndElementBlock) (NSString *elementName, NSMutableString *content);
typedef void(^FinishBlock) (HKResultMessage *resultMessage);

@interface HKResultMessage : NSObject

@property (nonatomic, assign) NSInteger netCode;
@property (nonatomic, assign) HKServiceError errorCode;
@property (nonatomic, assign) HKServiceResult result;
@property (nonatomic, strong) NSString *message;
@property (nonatomic, assign) long long uid;
@property (nonatomic, strong) NSString *did;
@property (nonatomic, strong) NSString *sid;
@property (nonatomic, assign) BOOL userState;
@property (nonatomic, strong) id object;
@property (nonatomic, assign) BOOL cacheComplete;

- (void)reset;
@end
